import axios from 'axios'


// 创造一个axios实例
const request = axios.create({
    baseURL: '/api1',
    timeout: 10000,
    headers: {}
})

// 设置请求拦截器
request.interceptors.request.use((config) => {
    return config
}), (error) => {
    return Promise.reject(error)
};

// 设置响应拦截器
request.interceptors.response.use((response) => {

    if (response.data.code !== 10000) {
        return Promise.reject({
            message: response.data.msg
        })
    }
return response.data.data
}), (error) => {
    return Promise.reject(error)
};

export default request;